home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / debugger / ddd-1.000 / ddd-1 / ddd-1.4b / etc / install-ftp < prev    next >
Encoding:
Text File  |  1996-01-11  |  6.7 KB  |  283 lines

  1. #! /bin/sh
  2. # $Id: install-ftp,v 1.11 1996/01/11 16:35:57 zeller Exp $
  3. # Install DDD release on our FTP server
  4.  
  5. # Copyright (C) 1995 Technische Universitaet Braunschweig, Germany.
  6. # Written by Andreas Zeller (zeller@ips.cs.tu-bs.de).
  7. # This file is part of DDD.
  8. # DDD is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public
  10. # License as published by the Free Software Foundation; either
  11. # version 2 of the License, or (at your option) any later version.
  12. # DDD is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. # See the GNU General Public License for more details.
  16. # You should have received a copy of the GNU General Public
  17. # License along with ICE -- see the file COPYING.
  18. # If not, write to the Free Software Foundation, Inc.,
  19. # 675 Mass Ave, Cambridge, MA 02139, USA.
  20. # DDD is the GDB-based data display debugger.
  21. # Contact ddd@ips.cs.tu-bs.de for details.
  22.  
  23. # Name of the ftp server (use "" if local)
  24. # ftp=ftp
  25. ftp=
  26.  
  27. # Directory
  28. dir=/ftp/pub/local/softech/ddd
  29.  
  30. # rsh and rcp commands
  31. if [ "$ftp" = "" ]; then
  32.   rsh="sh -c"
  33.   rcp="cp"
  34.   ftpdir=$dir
  35.  
  36.   if [ ! -d $ftpdir ]; then
  37.     echo $ftpdir: no such directory
  38.     exit 1
  39.   fi
  40. else
  41.   rsh="rsh $ftp"
  42.   rcp="rcp"
  43.   ftpdir="$ftp:$dir"
  44. fi
  45.  
  46. # diff command
  47. gdiff=/usr/local/bin/gdiff
  48.  
  49. # Introduction files
  50. README="ANNOUNCE    \
  51.         BUGS        \
  52.         COPYING     \
  53.         COPYING.LIB \
  54.         CREDITS     \
  55.     FAQ         \
  56.     INSTALL     \
  57.     NEWS        \
  58.     PROBLEMS    \
  59.     README      \
  60.     SERVICE     \
  61.     TODO        \
  62. "
  63.  
  64. # Manual files
  65. DVI="ddd.man.ps"
  66.  
  67. # Files to be ignored in DIFF files
  68. DIFF_IGNORE="
  69. doc/ddd*.ps
  70. ddd/vsl-lex.C
  71. ddd/vsl-gramma.C
  72. ddd/vsl-gramma.h
  73. ddd/ddd.man.txt
  74. ddd/ddd.man.C
  75. ddd/Ddd
  76. ddd/Ddd.ad.h
  77. ddd/xlibdir.C
  78. "
  79.  
  80. readme=false
  81. dist=false
  82. doc=false
  83. diff=false
  84. link=false
  85.  
  86. errors=false
  87. if [ $# = 0 ]; then
  88.   # Default: install all
  89.   readme=true
  90.   dist=true
  91.   doc=true
  92.   diff=true
  93.   link=true
  94. else
  95.   while [ $# != 0 ]; do
  96.     case "$1" in
  97.     -readme) readme=true; shift;;
  98.     -dist)   dist=true;   shift;;
  99.     -doc)    doc=true;    shift;;
  100.     -diff)   diff=true;   shift;;
  101.     -link)   link=true;   shift;;
  102.     *) echo "unknown option $1" >&2; errors=true; shift;;
  103.     esac
  104.   done
  105. fi
  106.  
  107. if $errors; then
  108.   exit 1
  109. fi
  110.  
  111. if $readme; then
  112.   for file in $README; do
  113.     $rsh "cd $dir; cat $file" | $gdiff -c5 $file -
  114.     if [ $? != 0 ]; then
  115.       echo installing $file in $ftpdir
  116.       $rsh "cd $dir; /bin/rm -f $README"
  117.       $rcp -p $README $ftpdir
  118.     fi
  119.   done
  120. fi
  121.  
  122. # Distribution files
  123. DDD=ddd-*.tar.gz
  124. DIST=`ls $DDD 2> /dev/null`
  125.  
  126. if $dist; then
  127.   if [ "$DIST" = "" ]; then
  128.      echo "cannot find dist file" >&2
  129.      exit 1
  130.   fi
  131.  
  132.   echo installing $DIST in $ftpdir/src...
  133.   $rsh "cd $dir/src; /bin/rm -f $DIST"
  134.   $rcp -p $DIST $ftpdir/src
  135. fi
  136.  
  137. if $doc; then
  138.   (
  139.   cd ddd
  140.   if [ ! -f Makefile ]; then
  141.     echo configuring ddd...
  142.     ./configure -v
  143.   fi
  144.  
  145.   echo making $DVI...
  146.   for dvi in $DVI; do
  147.     gmake ../doc/$dvi
  148.   done
  149.  
  150.   echo installing $DVI...
  151.   $rsh "cd $dir/doc; /bin/rm -f $DVI"
  152.   (cd ../doc; $rcp -p $DVI $ftpdir/doc)
  153.   $rsh "cd $dir/doc; gzip -f -v -9 $DVI"
  154.  
  155.   (cd ../doc; rm -f $DVI)
  156.   )
  157. fi
  158.  
  159. if $diff; then
  160.   if [ "$DIST" = "" ]; then
  161.      echo "cannot find dist file" >&2
  162.      exit 1
  163.   fi
  164.   echo installing diffs...
  165.   for dist in $DIST; do
  166.     dist_version=`echo $dist | sed 's%.*-\(.*\)\.tar.*%\1%'`
  167.     dist_release=ddd-$dist_version
  168.     echo unpacking $dist...
  169.     rm -fr $dist_release
  170.     gtar zxf $dist
  171.     for file in `$rsh "cd $dir/src; ls -t $DDD | head -2"`; do
  172.       if [ "$file" = "$dist" ]; then
  173.     continue
  174.       fi
  175.       file_version=`echo $file | sed 's%.*-\(.*\)\.tar.*%\1%'`
  176.       file_release=ddd-$file_version
  177.       diff=$file_release-$dist_version.diff
  178.  
  179.       rm -f $diff
  180.       rm -fr $file
  181.       echo getting $file...
  182.       $rcp -p $ftpdir/src/$file .
  183.       rm -fr $file_release
  184.       echo unpacking $file_release...
  185.       gtar zxf $file
  186.  
  187.       echo writing $diff header...
  188.       (
  189.       echo "This patch will bring a $file_release release up to $dist_release."
  190.       echo
  191.       echo "To apply this patch, do the following:";
  192.       echo
  193.       echo "1. Change to the directory containing the $file_release"
  194.       echo "   top-level directory, such that \`./$file_release/ANNOUNCE'"
  195.       echo "   contains the $file_release announement."
  196.       echo
  197.       echo
  198.       echo "2. Apply this patch on $file_release, using \`patch':"
  199.       echo
  200.       echo "   % patch < $diff"
  201.       echo
  202.       echo
  203.       echo "3. Check for any rejected patches (in \`.rej' files):"
  204.       echo
  205.       echo "   % find $file_release -name '*.rej' -print"
  206.       echo
  207.       echo "   Rejected patches must be resolved manually; some files"
  208.       echo "   can also be reconstructed using \`make'."
  209.       echo
  210.       echo
  211.       echo "4. Consider removing unnecessary \`.orig' files, using \`find:'"
  212.       echo
  213.       echo "   % find $file_release -name '*.orig' -exec rm -f {} \;"
  214.       echo
  215.       echo
  216.       echo "5. Consider removing files no more present in $dist_release."
  217.       echo "   You can find these files by looking for the text"
  218.       echo "   \`Only in $file_release:', below."
  219.       echo
  220.       echo
  221.       echo "6. Rename the \`$file_release' directory to \`$dist_release':"
  222.       echo
  223.       echo "   % mv $file_release $dist_release"
  224.       echo
  225.       echo
  226.       echo "That's all.  $dist_release should now be identical to the distributed version"
  227.       echo "-- besides any changes you made, of course."
  228.       echo
  229.       echo "Note that changes in the following files are NOT included in this patch,"
  230.       echo "since these files can easily be reconstructed using \`make':"
  231.       echo "$DIFF_IGNORE" | sed 's/^/    &/'
  232.       echo
  233.       echo "Please report any bugs to ddd-bugs@ips.cs.tu-bs.de."
  234.       echo
  235.       # echo "Prereq: $file_release"
  236.       # echo
  237.       ) > $diff
  238.  
  239.       (cd $file_release; rm -f $DIFF_IGNORE)
  240.       (cd $dist_release; tar cf - $DIFF_IGNORE) | 
  241.       (cd $file_release; tar xfBp -)
  242.  
  243.       echo finding $diff...
  244.       $gdiff -c2prP $file_release $dist_release | grep -v '^\\' >> $diff
  245.  
  246.       echo packing $diff...
  247.       rm -f $diff.gz
  248.       gzip -9 -c $diff > $diff.gz
  249.       chmod -w $diff $diff.gz
  250.  
  251.       echo installing $diff...
  252.       $rsh "cd $dir/diffs; /bin/rm -f $diff.gz"
  253.       $rcp -p $diff.gz $ftpdir/diffs
  254.  
  255.       echo removing $file_release...
  256.       rm -fr $file $file_release
  257.  
  258.     done
  259.     echo removing $dist_release...
  260.     rm -fr $dist_release
  261.   done
  262. fi
  263.  
  264. if $link; then
  265.   if [ "$DIST" = "" ]; then
  266.      echo "cannot find dist file" >&2
  267.      exit 1
  268.   fi
  269.   dist_base=`echo $dist | sed 's%.*-\(.*\)[a-z]*\.tar.*%\1%'`
  270.   link=ddd-$dist_base.tar.gz
  271.   echo installing link from $link to src/$DIST...
  272.   $rsh "cd $dir; /bin/rm -f $link; ln -s src/$DIST $link"
  273. fi
  274.  
  275. # That's all, folks
  276. # echo done.
  277. exit 0
  278.